package com.chocho.producerserver.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by chocho on 2022/4/16.
 */
@Mapper
@Repository
public interface PermissionDao {

    @Select("SELECT permission_name FROM op_permission LEFT JOIN op_role_permission ON op_permission.permission_id = op_role_permission.permission_id " +
            "LEFT JOIN op_user_role ON op_role_permission.role_id = op_user_role.role_id " +
            "LEFT JOIN op_user ON op_user_role.user_id = op_user.user_id " +
            "WHERE op_user.user_id = #{userId}")
    List<String> selectNameByUserID(String userId);
}
